<?php
declare(strict_types=1);
namespace Field;

class OneCrowdConst
{
    public const pk='';
    public const index=[];
	public const fields=['bizCode','campaignId','adgroupId','crowdId','crowdName','labelGroupName','labelName','campaignBidType','displayStatus','adgroupName','crowdTarget'];
	public const comment=['bizCode'=>'','campaignId'=>'','adgroupId'=>'','crowdId'=>'','crowdName'=>'','labelGroupName'=>'','labelName'=>'','campaignBidType'=>'','displayStatus'=>'','adgroupName'=>'','crowdTarget'=>''];
	/*
    * @Field bizCode
    * @Type varchar(255)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const bizCode = 'bizCode';
    /*
    * @Field campaignId
    * @Type bigint(20)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const campaignId = 'campaignId';
    /*
    * @Field adgroupId
    * @Type bigint(20)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const adgroupId = 'adgroupId';
    /*
    * @Field crowdId
    * @Type bigint(20)
    * @Collation 
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const crowdId = 'crowdId';
    /*
    * @Field crowdName
    * @Type varchar(64)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const crowdName = 'crowdName';
    /*
    * @Field labelGroupName
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const labelGroupName = 'labelGroupName';
    /*
    * @Field labelName
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const labelName = 'labelName';
    /*
    * @Field campaignBidType
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const campaignBidType = 'campaignBidType';
    /*
    * @Field displayStatus
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const displayStatus = 'displayStatus';
    /*
    * @Field adgroupName
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const adgroupName = 'adgroupName';
    /*
    * @Field crowdTarget
    * @Type varchar(32)
    * @Collation utf8mb4_general_ci
    * @Null YES
    * @Key 
    * @Default 
    * @Extra 
    * @Privileges select,insert,update,references
    * @Comment 
    */
    public const crowdTarget = 'crowdTarget';
}

class OneCrowdColumns
{
public  ?string $bizCode='';
   public  int $campaignId=0;
   public  int $adgroupId=0;
   public  int $crowdId=0;
   public  ?string $crowdName='';
   public  ?string $labelGroupName='';
   public  ?string $labelName='';
   public  ?string $campaignBidType='';
   public  ?string $displayStatus='';
   public  ?string $adgroupName='';
   public  ?string $crowdTarget='';
	public function toArray():array
	{
		return [
'bizCode'=>$this->bizCode,
    'campaignId'=>$this->campaignId,
    'adgroupId'=>$this->adgroupId,
    'crowdId'=>$this->crowdId,
    'crowdName'=>$this->crowdName,
    'labelGroupName'=>$this->labelGroupName,
    'labelName'=>$this->labelName,
    'campaignBidType'=>$this->campaignBidType,
    'displayStatus'=>$this->displayStatus,
    'adgroupName'=>$this->adgroupName,
    'crowdTarget'=>$this->crowdTarget,        ];
	}
}

class OneCrowdRow
{
	public OneCrowdColumns $data;
	public function toArray():array
	{
		return $this->data->toArray();
    }

    public function getValue(string $field):string|int|null
    {
        return match ($field){
        'bizCode' => $this->data->bizCode,
        'campaignId' => $this->data->campaignId,
        'adgroupId' => $this->data->adgroupId,
        'crowdId' => $this->data->crowdId,
        'crowdName' => $this->data->crowdName,
        'labelGroupName' => $this->data->labelGroupName,
        'labelName' => $this->data->labelName,
        'campaignBidType' => $this->data->campaignBidType,
        'displayStatus' => $this->data->displayStatus,
        'adgroupName' => $this->data->adgroupName,
        'crowdTarget' => $this->data->crowdTarget, default=>null
        };
    }

    public function __construct(array $data)
    {
        $this->data = new OneCrowdColumns();
        isset($data['bizCode']) && $this->data->bizCode = (string)$data['bizCode'];
           isset($data['campaignId']) && $this->data->campaignId = (int)$data['campaignId'];
           isset($data['adgroupId']) && $this->data->adgroupId = (int)$data['adgroupId'];
           isset($data['crowdId']) && $this->data->crowdId = (int)$data['crowdId'];
           isset($data['crowdName']) && $this->data->crowdName = (string)$data['crowdName'];
           isset($data['labelGroupName']) && $this->data->labelGroupName = (string)$data['labelGroupName'];
           isset($data['labelName']) && $this->data->labelName = (string)$data['labelName'];
           isset($data['campaignBidType']) && $this->data->campaignBidType = (string)$data['campaignBidType'];
           isset($data['displayStatus']) && $this->data->displayStatus = (string)$data['displayStatus'];
           isset($data['adgroupName']) && $this->data->adgroupName = (string)$data['adgroupName'];
           isset($data['crowdTarget']) && $this->data->crowdTarget = (string)$data['crowdTarget'];
    }
}
?>